package com.tiancheng.trade.payment.controller.api;

import com.tiancheng.trade.commom.core.data.Result;
import com.tiancheng.trade.payment.service.SettleFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import jakarta.validation.constraints.NotBlank;

/**
 * 对账手动触发
 */
@RestController
@RequestMapping("/api/task")
@Validated
public class TaskController {
//    @Resource
//    UmsSettleTask umsSettleTask;
    @Autowired
    private SettleFileService settleFileService;

//    /**
//     * 处理划付回盘文件
//     *
//     * @param settleDate 划付日期
//     * @return 处理结果
//     */
//    @PostMapping("/settleCounteroffer")
//    public Result get(@NotBlank @RequestParam("settle_date") String settleDate) {
//        return Result.success(umsSettleTask.umsSettleCounterofferHandle(settleDate));
//    }
//
//    /**
//     * 处理划付上传文件
//     *
//     * @return 处理结果
//     */
//    @PostMapping("/doUploadSettle")
//    public Result doUploadSettle() {
//        return Result.success(umsSettleTask.uploadSettle(null));
//    }
//

    /**
     * 设置整批次的划付、分佣为失败
     *
     * @param apprFileName 划付日期
     * @return 处理结果
     */
    @PostMapping("/setSettleError")
    public Result setSettleError(@NotBlank @RequestParam("appr_file_name") String apprFileName) {
        settleFileService.setSettleError(apprFileName);
        return Result.success();
    }
}
